package com.swift.maintenance.bean;

import org.xutils.db.annotation.Column;
import org.xutils.db.annotation.Table;

import android.util.SparseArray;

import com.swift.bean.EntityBase;
import com.swift.bean.NameEntity;

@Table(name = "company")
public class Company extends NameEntity {

	@Column(name = "dept_id")
	private int dept_id;

	@Column(name = "lastUpdateTime")
	private int lastUpdateTime = 0;

	@Column(name = "taskUpdateTime")
	private int taskUpdateTime = 0;

	@Column(name = "code")
	private String code;
	
	@Column(name = "company_logo")
	private String company_logo;
	

	public String getCompany_logo() {
		return company_logo;
	}
	
	public void setCompany_logo(String company_logo) {
		this.company_logo = company_logo;
	}
	
	public int getTaskUpdateTime() {
		return taskUpdateTime;
	}

	public void setTaskUpdateTime(int taskUpdateTime) {
		this.taskUpdateTime = taskUpdateTime;
	}

	public int getLastUpdateTime() {
		return lastUpdateTime;
	}

	public void setLastUpdateTime(int lastUpdateTime) {
		this.lastUpdateTime = lastUpdateTime;
	}

	public int getDept_id() {
		return dept_id;
	}

	public void setDept_id(int dept_id) {
		this.dept_id = dept_id;
	}

	public Company() {
		// TODO Auto-generated constructor stub
	}

	private static SparseArray<Company> companyCache;

	public static Company getCompany(int id) {
		if (companyCache == null) {
			companyCache = new SparseArray<Company>();
		}
		Company company = companyCache.get(id);
		if (company == null) {
			company = EntityBase.findInstance(Company.class, id);
			if (companyCache.size() > 32) {
				companyCache.removeAt(0);
			}
			companyCache.put(id, company);
		}
		return company;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}
	
	@Override
	public String getTextName() {
		return getName();
	}
}
